>The Icon file management routines are based on the C <stdio.h> facilitates.
>The Icon open mode specifications are mapped to the C fopen mode parameter,
>and unfortunately the available fopen modes vary from platform to platform.
>
>Do you have a C compiler for the Macintosh MPW environment? If so, try to
>see which C fopen modes will give you the desired results. From this, we can
>figure out the how to fix the Icon run time code.
Thanks for your response Frank. I don't quite understand; the mode to pass to fopen for updating a file is "r+" on every platform (the lower level Mac toolbox call is something funky but the standard C library function is "standard"). I checked the "r+" mode on my problem file using a C program. "f = fopen( "Testfile", "r+" );" works fine. Thereafter I can read lines with fgets() or write to random locations using fseek() and fprintf() or fputs().
Of course I'm using an up-to-date StdCLib (I'm using MacOS 8.6 and MPW / MrC with Universal Interfaces 3.2). I'm also using the new file system, HFS+, which (I hope) is transparent at the level of standard C functions. Maybe MPW Icon (9.0) just needs to be recompiled against new libraries -- but that's easier said than done. It would become somewhat larger (because of changing from 68K to PowerPC RISC instructions) and much faster. Would anyone be willing to help me?
(As for my immediate problem -- it is perhaps most simply solved by using Icon for the analysis and reporting functions, in which it excels, and dropping back to C for writing my files in the first place. Since what I'm working on is a notekeeper/outliner to use in my MPW programming environment, I can tie Icon and C programs together using the Shell.)
>----- Original Message -----
>From: Garry <memphis@macconnect.com>
>
>> The most up-to-date Icon available for the Macintosh MPW environment is
>> version 9.0, which I think may have been implemented by Bob Alexander
>> (email address?). I've implemented most of an outline processor / note
>> organizer for MPW using Icon; maybe I'll proceed to try using it for
>> keeping source code in outline form, BUT after more than a month of fun
>> with Icon I've run into a problem!! I can't open a file for update
>> (read/write). When I follow the Icon practice of opening my file with
>> "b" mode I find that I can read it but I can not write to the file. For
>> example if I execute
>> f := open( "Testfile", "b" )
>> seek( f )
>> writes( f, "**" )
>> where "Testfile" is a small test file created previously, then I get the
>> message
>> Run-time error 214
>> input/output error
>>
>> I've tried specifying "r+" mode or "b+r" or "ub" mode without success.